<div id="result">

<div class="shippings index">
<?php echo $this->Session->flash(); ?>
	<div class="div_header1"><?php __('Shipping Methods');?></div>
	<br style="clear:both;">
	<a href="javascript:void(0);"  controller="shippings" action="shippingmethodadd" onclick="showPop(this);">Add shipping Methods</a>
	 <table id="category_table" cellspacing="0" class="tablesorter">
		<thead>
	<tr>
			<th width="22"><?php echo __('id');?></th>			
			<th width="65"><?php echo __('Shipping Method');?></th>			
			<th width="80"><?php echo __('Weight');?></th>			
			<th width="30"><?php echo __('Cost');?></th>			
			<th width="55"><?php __('Actions');?></th>
	</tr>
	</thead>
	<?php
	$i = 0;
	foreach ($shippings as $shipping):
		$class = null;
		$row_selector = ' id="row_'.$shipping['Shipping']['id'].'"';
		$row_selector_edit = ' id="row_edit_'.$shipping['Shipping']['id'].'"';
		if ($i++ % 2 == 0) {			
			$class = ' class="alt"';
			$style = ' style="display:none;"';
		}
	?>
	<tr<?php echo $row_selector;?>>
		<td<?php echo $class;?>><?php echo $i; ?></td>		
		<td<?php echo $class;?>><?php echo $shipping['Shipping']['shipping_method']; ?></td>		
		<td<?php echo $class;?>><?php echo $shipping['Shipping']['weight_min'].' lbs - '.$shipping['Shipping']['weight_limit'].'  lbs'; ?></td>
		<td<?php echo $class;?>><?php echo $shipping['Shipping']['shipping_cost']; ?>&nbsp;</td>		
		<td <?php echo $class;?>>	
			<a href="javascript:void(0);" controller="shippings" action="edit" ElmID="<?php echo $shipping['Shipping']['id'];?>" onclick="showPop(this);" >Edit</a>
			<a href="javascript:void(0);" onclick="return deleteconfirm(this);" controller="shippings" action="delete" title="Delete" ElmID="<?php echo $shipping['Shipping']['id'];?>" ElmID2="<?php echo $this->data['cat_id'];?>">Delete</a>
			
		</td>
	</tr>
	
	<tr<?php echo $row_selector_edit.$style;?>>
		<td<?php echo $class;?> colspan="8">
		<form method="post" action="javascript:void(0);" name="form_<?php echo $shipping['Shipping']['id'];?>" id="form_<?php echo $shipping['Shipping']['id'];?>">
		<?php echo $this->Form->input('id',array('div'=>false,'label'=>false,'type'=>'hidden','style'=>'width:22px','value'=>$shipping['Shipping']['id'])); ?>&nbsp;		
		<?php echo $this->Form->input('category_id',array('div'=>false,'label'=>false,'type'=>'hidden','value'=>$shipping['Shipping']['category_id'])); ?>&nbsp;		
		<?php echo $this->Form->input('shipping_method',array('div'=>false,'label'=>false,'style'=>'width:80px','value'=>$shipping['Shipping']['shipping_method'],'class'=>'required','title'=>'Shipping method cannot be left empty'));?>
		
		<?php echo $this->Form->input('shipping_destination',array('div'=>false,'label'=>false,'style'=>'width:80px','options' => array('National'=>'National','International'=>'International'),'selected'=>$shipping['Shipping']['shipping_destination'],'class'=>'required','title'=>'Shipping destination cannot be left empty'));?>&nbsp;
		<?php echo $this->Form->input('shipping_cost',array('div'=>false,'label'=>false,'style'=>'width:54px','class'=>'required','value'=>$shipping['Shipping']['shipping_cost'])); ?>&nbsp;&nbsp;
		
			<a href="javascript:void(0);" class="updateshipping"  controller="shippings" action="edit" ElmID="<?php echo $shipping['Shipping']['id'];?>">Update</a>			
		</form>
		</td>
	</tr>
<?php endforeach; ?>
	</table>
	
</div>
</div>
<?php echo $this->Html->css('table_css');?>
<?php  echo $html->script(array("jquery.tablesorter.min.js","jquery.tablednd.js")); ?>	 
 <script type="text/javascript"> 
 
 jQuery(document).ready(function(){
 
 jQuery("#category_table").tablesorter({headers: { 4:{sorter: false}}}); 
 jQuery(".editshipping").click(function(){
	rowID=jQuery(this).attr('ElmID');
	jQuery("#row_edit_"+rowID).show().fadeIn("slow");
	jQuery("#row_"+rowID).hide().fadeOut("slow"); 
 });
 jQuery(".updateshipping").click(function(){
	rowID=jQuery(this).attr('ElmID');	
	data=jQuery("#form_"+rowID).serialize();
	//alert(data);
	jQuery.ajax({
			type: 'POST',
			data: data,
			url: baseurl+"shippings/editshipping/",			
			/*dataType: 'json',
			success: function(data){
				if(data.message=="Yes")
				{
					jQuery("#row_edit_"+rowID).hide().fadeOut("slow");
					jQuery("#row_"+rowID).show().fadeIn("slow"); 
				}
				return false;
			}*/			
		});	
 });
 });
 function deleteconfirm(param){
		if(confirm("Are you sure you want to delete it?"))
		showPop(param);
		else
		return false;
	}
 </script>